package com.ruoyi.web.controller.api;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.estate.Advertisement;
import com.ruoyi.system.service.estate.IAdvertisementService;
import com.ruoyi.common.annotation.Anonymous;

/**
 * 广告信息API Controller
 * 
 * @author ruoyi
 */
@RestController
@RequestMapping("/api/advert")
public class AdvertApiController extends BaseController {
    
    @Autowired
    private IAdvertisementService advertisementService;
    
    /**
     * 获取轮播图列表
     */
    @Anonymous
    @GetMapping("/carousel")
    public AjaxResult getCarouselList() {
        Advertisement advert = new Advertisement();
        // 设置查询条件：已发布状态、首页轮播位置
        advert.setStatus("0"); // 正常状态
        advert.setAdStatus("1"); // 已发布
        advert.setAdLocation("0"); // 首页轮播
        List<Advertisement> list = advertisementService.selectAdvertisementList(advert);
        return AjaxResult.success(list);
    }
} 